package cn.chia.back.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Component;

import cn.chia.back.dao.IActivityTypeDAO;
import cn.chia.pojo.TblActivityType;
import cn.chia.pojo.TblItems;

@Component
public class ActivityTypeDAOImpl extends HibernateDaoSupport implements IActivityTypeDAO {

	@Autowired
	public ActivityTypeDAOImpl(HibernateTemplate hibernateTemplate){
		super.setHibernateTemplate(hibernateTemplate);
	}
	
	/**
	 * @author Administrator
	 * @Todo 添加新的活动种类
	 * @param activityType
	 * @throws Exception
	 */
	public void insert(TblActivityType activityType) throws Exception {
		this.getHibernateTemplate().save(activityType);
	}

	/**
	 * @author Administrator
	 * @Todo 查询活动的全部种类
	 * @return 活动种类的list集合
	 * @throws Exception
	 */
	public List<TblActivityType> findActivityType() throws Exception {
		String hql = "FROM TblActivityType";
		Query query = getSession().createQuery(hql);
		return query.list();
	}

}
